package com.cwj.mansysback.servlet.impl;

import com.cwj.mansysback.entity.Rank;
import com.google.gson.Gson;

import javax.servlet.ServletResponse;
import java.io.IOException;

public class Statement {

    private  static final String[] messages={
            "成功","密码错误",//0,1
            "用户名不存在","用户名和密码均不能为空",//2,3
            "身份认证失败", "服务器出错，原本请求的报文为空",//4,5
            "权限不足","信息获取失败",//6,7
            "请求参数和请求路径不匹配","更新失败",//8,9
            "受外键引用","注销失败",//10,11
            "失败","编号重复",//12，13
            "编号不存在",//14
    };

    private Integer statue;

    private String message;

    public Statement(Integer statue, String message) {
        this.statue = statue;
        this.message = message;
    }

    public Integer getStatue() {
        return statue;
    }

    public Statement(Integer statue) {
        this.statue = statue;
        this.message=messages[statue];
    }

    public void setStatue(Integer statue) {
        this.statue = statue;
        this.message = Statement.getMessage(statue);
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Statement() {
    }

    public static String getMessage(int index){
        return Statement.messages[index];
    }

}
